package com.crealth.model;

import java.io.Serializable;
import java.sql.Timestamp;

import com.alibaba.fastjson.JSONObject;

public class MonthPlanModel implements Serializable {
	private static final long serialVersionUID = 2821L;
	private long id;  // 周计划
	private int userID;
	private int month;  //一年中的 月份
	private int planSqjs;  //申请件数
	private int planFkjs;  //放款件数
	private int planFkje;  //放款金额
	private int planJhcs;  //创收
	private int planSqkh;  //申请客户
	private int signedCnt;  // 实际申请件数
	private int extendLoanCnt;  // 放款件数
	private int extendLoanMoney; // 放款金额
	private double brokerageMoney;  // 佣金  创收
	private double basePushMoney;  // 基本提成
	private double extraPushMoney;  // 额外提成
	private Timestamp planTm;  // 提交计划的时间
	
	public MonthPlanModel() {
		month = 0;
		planSqjs = 0;
		planFkjs = 0;
		planFkje = 0;
		planJhcs = 0;
		planSqkh = 0;
		planTm = null;
		
		signedCnt = 0;
		extendLoanCnt = 0;
		extendLoanMoney = 0;
		brokerageMoney = 0;
		basePushMoney = 0;
		extraPushMoney = 0;
	}
	
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public int getUserID() {
		return userID;
	}
	public void setUserID(int userID) {
		this.userID = userID;
	}
	public int getMonth() {
		return month;
	}
	public void setMonth(int month) {
		this.month = month;
	}
	public int getPlanSqjs() {
		return planSqjs;
	}
	public void setPlanSqjs(int planSqj) {
		this.planSqjs = planSqj;
	}
	public int getPlanFkjs() {
		return planFkjs;
	}
	public void setPlanFkjs(int planFkjs) {
		this.planFkjs = planFkjs;
	}
	public int getPlanFkje() {
		return planFkje;
	}
	public void setPlanFkje(int planFkje) {
		this.planFkje = planFkje;
	}	
	public int getPlanJhcs() {
		return planJhcs;
	}
	public void setPlanJhcs(int planJhcs) {
		this.planJhcs = planJhcs;
	}
	public int getPlanSqkh() {
		return planSqkh;
	}
	public void setPlanSqkh(int planSqkh) {
		this.planSqkh = planSqkh;
	}	
	public int getSignedCnt() {
		return signedCnt;
	}
	public void setSignedCnt(int signedCnt) {
		this.signedCnt = signedCnt;
	}
	public int getExtendLoanCnt() {
		return extendLoanCnt;
	}
	public void setExtendLoanCnt(int extendLoanCnt) {
		this.extendLoanCnt = extendLoanCnt;
	}
	public int getExtendLoanMoney() {
		return extendLoanMoney;
	}
	public void setExtendLoanMoney(int extendLoanMoney) {
		this.extendLoanMoney = extendLoanMoney;
	}
	public double getBrokerageMoney() {
		return brokerageMoney;
	}
	public void setBrokerageMoney(double brokerageMoney) {
		this.brokerageMoney = brokerageMoney;
	}
	public double getBasePushMoney() {
		return basePushMoney;
	}
	public void setBasePushMoney(double basePushMoney) {
		this.basePushMoney = basePushMoney;
	}
	public double getExtraPushMoney() {
		return extraPushMoney;
	}
	public void setExtraPushMoney(double extraPushMoney) {
		this.extraPushMoney = extraPushMoney;
	}	
	public Timestamp getPlanTm() {
		return planTm;
	}
	public void setPlanTm(Timestamp planTm) {
		this.planTm = planTm;
	}

	public JSONObject toJSONObject() {
		JSONObject jsonObj = new JSONObject();
		jsonObj.put("id", id);
		jsonObj.put("userID", userID);
		jsonObj.put("month", month);
		jsonObj.put("planSqjs", planSqjs);
		jsonObj.put("planFkjs", planFkjs);
		jsonObj.put("planFkje", planFkje);
		jsonObj.put("planJhcs", planJhcs);
		jsonObj.put("planSqkh", planSqkh);
		if (planTm != null) {
			jsonObj.put("planTm", planTm.getTime() / 1000);
		}
		
		jsonObj.put("signedCnt", signedCnt);
		jsonObj.put("extendLoanCnt", extendLoanCnt);
		jsonObj.put("extendLoanMoney", extendLoanMoney);
		jsonObj.put("brokerageMoney", "" + brokerageMoney);
		jsonObj.put("basePushMoney", "" + basePushMoney);
		jsonObj.put("extraPushMoney", "" + extraPushMoney);
		
		return jsonObj;
	}
	
	public void parseFromJson(JSONObject resJson) {
		if (resJson.containsKey("planSqjs")) {
			planSqjs = resJson.getIntValue("planSqjs");
		}
		if (resJson.containsKey("planFkjs")) {
			planFkjs = resJson.getIntValue("planFkjs");
		}
		if (resJson.containsKey("planFkje")) {
			planFkje = resJson.getIntValue("planFkje");
		}
		if (resJson.containsKey("planJhcs")) {
			planJhcs = resJson.getIntValue("planJhcs");
		}
		if (resJson.containsKey("planSqkh")) {
			planSqkh = resJson.getIntValue("planSqkh");
		}
		
	}
		
}
